#include "toolbar.h"

#include <QHBoxLayout>

ToolBar::ToolBar( PluginHandler * pluginHandler, QWidget * parent ) : QToolBar( parent ) {
    this->addPluginStarters( pluginHandler );
    this->addSeparator();
    this->addStandardActions();
}

void ToolBar::addPluginStarters( PluginHandler * pluginHandler ) {
    // get plugin starters from plugin handler
    foreach ( WhalePluginStarter * starter, pluginHandler->starters() ) {
        this->addAction( starter );
    }
}

void ToolBar::addStandardActions() {
    this->mConfigureAction = new QAction( this );
    this->mConfigureAction->setIcon( QIcon( ":/images/oxygen/configure.png" ) );
    this->mConfigureAction->setWhatsThis( "Configure SocialWhale" );

    this->mLogoutAction = new QAction( this );
    this->mLogoutAction->setIcon( QIcon( ":/images/oxygen/logout.png" ) );
    this->mLogoutAction->setWhatsThis( "Logout" );

    this->addAction( this->mConfigureAction );
    this->addAction( this->mLogoutAction );

    this->setObjectName( "toolbar" );
}

QAction * ToolBar::configureAction() {
    return this->mConfigureAction;
}

QAction * ToolBar::logoutAction() {
    return this->mLogoutAction;
}
